import 'package:flutter/material.dart';

class IconSection extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Row(
      // 主轴上面 距离横向排列
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: <Widget>[
        _IconLabel(title: 'CALL', icon: Icons.call),
        _IconLabel(title: 'ROUTE', icon: Icons.near_me),
        _IconLabel(title: 'SHARE', icon: Icons.share),
      ],
    );
  }
}

// 他是IconSection 这个组件类当中的私有组件
class _IconLabel extends StatelessWidget {
  // 传参  @required指必填项
  _IconLabel({Key key, @required this.icon, @required this.title}) : super(key: key);
  final IconData icon;
  final String title;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Container(
          margin: EdgeInsets.only(bottom: 5),
          child: Icon(icon, color: Colors.blue),
        ),
        Text(
          '$title',
          style: TextStyle(color: Colors.blue),
        )
      ],
    );
  }
}
